#ifndef _ADC_H_
#define _ADC_H_
#include "Global.h"

#define ADC0_FOTMAT_8BIT     0b00000000
#define ADC0_FORMAT_12BIT    0b00010000
#define ADC0_AIN0            0b00000000
#define ADC0_AIN1            0b00000001
#define ADC0_AIN2            0b00000010
#define ADC0_AIN3            0b00000011
#define ADC0_AIN4            0b00000100
#define ADC0_AIN5            0b00000101
#define ADC0_AIN6            0b00000110
#define ADC0_AIN7            0b00000111
#define ADC0_OPA0O           0b00001000
#define ADC0_OPA1O           0b00001001
#define ADC0_VDET            0b00001010
#define ADC0_OCPOUT          0b00001011
#define ADC0_VBG             0b00001100

#define ADC1_VREF_AVDD       0b00000000
#define ADC1_VREF_ADCREF     0b00001000

#define ADC1_CLK_FSYS        0b00000000
#define ADC1_CLK_FSYS_2      0b00000001
#define ADC1_CLK_FSYS_4      0b00000010
#define ADC1_CLK_FSYS_8      0b00000011
#define ADC1_CLK_FSYS_16     0b00000100
#define ADC1_CLK_FSYS_32     0b00000101
#define ADC1_CLK_FSYS_64     0b00000110
#define ADC1_CLK_FSYS_128    0b00000111

void initADC(void);
void DeInitADC(void);
#define START_ADC()     do{_start = 0; _start = 1; _satrt = 0; while(_eocb);}while(0)
uint16 GetADC(uint8 channel);
void SelectADCChannel(uint8 channel);
uint16 ADConverter(void);


#endif
